home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
130 MIDI Tool Box
/
130 MIDI Tool Box.iso
/
mpubas
/
mpubas.
next >
Wrap
Text File
|
1987-05-09
|
2KB
|
48 lines
1 ' BASIC routine to read and write to MPU-401
2 ' Writen by: Michel Poirier
3 ' For : MIDICOM, Montreal
4 ' FidoNet ID 167/111
5 ' 514-744-7354
10 '---------------------------------------------------
11 ' INITIALISATION
12 '---------------------------------------------------
20 KEY OFF: DEFINT A-Z: SCREEN 0,0,0: CLS
30 '
40 COMPORT=817 ' To send commands to MPU-401
41 DATAPORT=816 ' Send & Receive DATA through this port
42 STATPORT=817 ' Read Status of MPU-401 through this port
43 DSR=128 ' Data Send Ready READY WHEN DSR BIT IS SET
44 DRR=64 ' Data Receive Ready READY WHEN DRR BIT IS SET
50 UART=63 ' Command to put MPU-401 in UART mode
51 ACK=254 ' Acknoledge from MPU-401
52 RST=255 ' Resets MPU-401
53 CHANNEL=0 ' MIDI channel 1
55 '
80 GOTO 260
90 '--------------------------------------------------
91 ' SEND DATA IN MIDIOUT$ TO MPU-401
94 '--------------------------------------------------
100 WHILE (INP(STATPORT) AND DRR)=DRR: WEND
110 FOR C=1 TO LEN(MIDIOUT$)
120 OUT DATAPORT,ASC(MID$(MIDIOUT$,C,1))
130 NEXT C
140 RETURN
150 '--------------------------------------------------
151 ' READ ONE BYTE FROM MPU-401
152 '--------------------------------------------------
160 B=0
170 WHILE (INP(STATPORT) AND DSR)=DSR: WEND
180 B=INP(DATAPORT)
190 RETURN
200 '--------------------------------------------------
201 ' SEND COMMAND IN CMD TO MPU-401
202 '--------------------------------------------------
210 WHILE (INP(STATPORT) AND DRR)=DRR: WEND
220 OUT COMPORT,CMD
230 B=INP(DATAPORT): IF B<>ACK THEN 210
240 RETURN
250 '--------------------------------------------------
251 ' PROGRAM START
252 '--------------------------------------------------
260 CMD=UART: GOSUB 210